#include <cstdio>
#include <cstdlib>
#include <ctime>

typedef struct MyVector {
    int size, cnt;
    int *data;
} MyVector;

MyVector *initVector(int n) {
    MyVector *p = new MyVector;
    p->size = n;
    p->cnt = 0;
    p->data = new int[n];
    return p;
}

bool isEmpty(MyVector *p) {
    return p->cnt == 0;
}

bool isFull(MyVector *p) {
    return p->cnt == p->size;
}

bool pushBack(MyVector *p, int val) {
    if(isFull(p)) return false;
    p->data[p->cnt++] = val;
    return true;
}

bool popBack(MyVector *p) {
    if(isEmpty(p)) return false;
    --p->cnt;
    return true;
}

void printVector(MyVector *p) {
    for(int i = 0; i < p->cnt; i++) {
        if(i) printf(" ");
        printf("%d", p->data[i]);
    }
    printf("\n");
}

void clear(MyVector *p) {
    if(p == NULL) return ;
    delete []p->data;
    delete p;
    return ;
}

const int MAX_N = 15;

int main() {
    srand(time(0));
    MyVector *p = initVector(MAX_N);
    for(int i = 0; i < 10; i++) {
        pushBack(p, rand() % 100);
    }
    printVector(p);
    clear(p);
    return 0;
}